<?php
App::uses('AppModel', 'Model');
/**
 * Aluno Model
 *
 */
class Aluno extends AppModel {
/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'nome';
	
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'matricula' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Por favor, informe a matrícula do solicitante.',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'unique' => array(
				'rule' => array('isUnique'),
				'message' => 'Verifique a matrícula, já existe um aluno cadastrado com esta matrícula.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			
		),
		'nome' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Por favor, informe o nome do solicitante.',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'curso_id' => array(
				'notempty' => array(
						'rule' => array('notempty'),
						'message' => 'Por favor, informe o curso do aluno.',
						'allowEmpty' => false,
						'required' => true,
						//'last' => false, // Stop validation after this rule
						//'on' => 'create', // Limit validation to 'create' or 'update' operations
				),
		),
		'email' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Por favor, informe o e-mail do solicitante.',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
			'email' => array(
				'rule' => array('email'),
				'message' => 'Por favor, informe um e-mail válido',
				'allowEmpty' => false,
				'required' => true,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	
	public $belongsTo = array(
		'Curso' => array(
				'className' => 'Curso',
				'foreignKey' => 'curso_id',
				'conditions' => '',
				'fields' => '',
				'order' => ''
		),
	);
			
}
